package cn.lx.service;

import cn.lx.init.MyInit;
import cn.lx.mapper.IndexMapper;
import cn.lx.pojo.TlIndex;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Set;

@Service

public class IndexServiceImpl implements IndexService {

    @Autowired
    IndexMapper indexMapper;
    @Override
    public List<TlIndex> search(String word){

        return indexMapper.search(word);

    }

    @Override
    public Set<String> search2(String word){

       return (Set<String>) MyInit.likeSearch.search(word,20);
       /* LikeSearch<String> search=new LikeSearch<String>();
        List<TlIndex> all = indexMapper.listAll();
        for (TlIndex index : all) {
            search.put(index.getCompany_name(), index.getCompany_name() + index.getId());
        }
        Set<String> search1 = (Set<String>) search.search(word,20);
        for(Iterator it = search1.iterator(); it.hasNext();){
            System.out.println(it.next());
        }
        return search1;*/
    }


    @Override
    public List<TlIndex> all() {
        return indexMapper.listAll();
    }

}
